package gui.drawers;

import java.awt.Graphics;

import dal.MapStruct;
import dal.object.Ball;
import dal.object.Shadow;

@SuppressWarnings("serial")
public class ShadowDrawer extends Drawer {
	private final int k = 4;
	private int x = Ball.getDx();
	private int y = Ball.getDy();
	private Shadow ballShadow;
	
	public ShadowDrawer(MapStruct ms){
		this.setOpaque(false);
		this.setSize(ms.getSize());
		ballShadow = new Shadow();
		img = ballShadow.getImage();
	}
	
	/**
	 * @param x, y
	 * 	draws the shadow on the given position
	 */
	public void drawShadow(int x, int y){
		this.x = x;
		this.y = y;
		repaint();
	}
	
	protected void paintComponent(Graphics g){
		g.drawImage(img, x + k, y + k, null);
	}
	
	/**
	 * same as repaint
	 */
	public void repaintAll() {
		this.repaint();
	}

	/**
	 * resets the ball shadow
	 */
	public void reset() {
		img = ballShadow.getImage();
	}
}
